﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace EIA.SLClient.Utility.Converters
{
    public class Number2VisibilityConverter : GenericConverter<int?, Visibility>
    {
        public Number2VisibilityConverter()
            : base((s, p) => {
                if (p != null && Consts.InversionTags.Contains(p.ToString().Trim().ToLower()))
                {
                    return s == 0 || s == null ? Visibility.Visible : Visibility.Collapsed;
                }
                else
                {
                    return s != 0 && s != null ? Visibility.Visible : Visibility.Collapsed;
                }
            }, (s, p) => {
                if (p != null && Consts.InversionTags.Contains(p.ToString().Trim().ToLower()))
                {
                    return s == Visibility.Visible ? 0 : 1;
                }
                else
                {
                    return s == Visibility.Visible ? 1 : 0;
                }
            })
        { }
    }
}
